﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加用户 - QAdmin后台模板</title>
    <link rel="stylesheet" href="~/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="~/static/admin/css/style.css">

    <script src="~/static/common/layui/layui.js"></script>
    <script src="~/static/common/jquery-3.3.1.min.js"></script>
    <script src="~/static/common/vue.min.js"></script>
    <script src="~/static/admin/js/config.js"></script>
    <script src="~/static/admin/js/script.js"></script>
    <title>添加</title>
</head>
<body>
    <div class="right">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>添加用户</legend>
        </fieldset>
        <div class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">用户编号</label>
                <div class="layui-input-block">
                    <input type="text" name="User_Id" id="User_Id" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮编</label>
                <div class="layui-input-block">
                    <input type="text" name="Delivery_Zipcode" id="Delivery_Zipcode" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-block">
                    <input type="text" name="Delivery_TelPhone" id="Delivery_TelPhone" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" id="isvip">
                <label class="layui-form-label">收件人名</label>
                <div class="layui-input-block">
                    <input type="text" id="Delivery_Name" name="Delivery_Name" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">配送地址</label>
                <div class="layui-input-block">
                    <select name="Delivery_Adress" id="Delivery_Adress" aria-controls="sample-table" class="">
                        <option value="1">深圳市光明区</option>
                        <option value="2">广东市白云区</option>
                        <option value="3">北京市崇文区</option>
                        <option value="4">长沙市雨花区</option>
                        <option value="5">邵阳市北塔区</option>
                        @*<input type="password" name="Questions_Type" id="Questions_Type" required=required lay-verify="required" placeholder="" autocomplete="off" class="layui-input" />*@
                    </select>
                </div>
            </div>

        </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="button" id="commit" value="立即提交" class="layui-btn">
                </div>
            </div>
        </div>
</body>
</html>
<script>
    //添加
    $("#commit").click(function () {
        var deliveryAddress = {};
        deliveryAddress.User_Id = $("#User_Id").val();
        deliveryAddress.Delivery_Zipcode = $("#Delivery_Zipcode").val();
        deliveryAddress.Delivery_TelPhone = $("#Delivery_TelPhone").val();
        deliveryAddress.Delivery_Name = $("#Delivery_Name").val();
        deliveryAddress.Delivery_UpdateTime = $("#Delivery_UpdateTime").val();
        deliveryAddress.Delivery_CreateTime = $("#Delivery_CreateTime").val();
        

        $.ajax({
            type: "post",
            data: deliveryAddress,
            url: "/DeliveryAddress/AddDeliveryAddress",
            success: function (result) {
                if (result.Success) {
                    layer.msg('添加成功！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    }
                        , function () {
                            window.location.href = '/Home/DeliveryAddress';
                        });
                } else {
                    layer.alert('添加失败！', {
                        title: '提示框',
                        icon: 1,
                    });
                }
            },
        });
    });
</script>